import 'package:flutter/material.dart';
import 'package:flutter_app10/configs/app_style_config.dart';
import 'package:flutter_app10/models/homepage/cjeb_cell_model.dart';
import 'package:flutter_app10/view/homepage/cjeb_cell_widget.dart';
import 'package:flutter_app10/view/homepage/pub_title_cell_widget.dart';



class CjebPage extends StatefulWidget {
  @override
  _CjebPageState createState() => _CjebPageState();
}

class _CjebPageState extends State<CjebPage> {


  List dataSource = [
    {"name":"DF","price":"0.9663","turnover":"14.56"},
    {"name":"GNX","price":"0.032923","turnover":"9.61"},
    {"name":"FLOW","price":"28.7186","turnover":"3.2"},
    {"name":"NSURE","price":"1.0122","turnover":"2.75"},
    {"name":"WOO","price":"0.35364","turnover":"2.6"},
    {"name":"WOO","price":"0.00064350","turnover":"2.36"},
    {"name":"VALUE","price":"5.7019","turnover":"2.01"},
    {"name":"SNC","price":"0.00000084","turnover":"1.99"},
    {"name":"BADGER","price":"49.1994","turnover":"1.56"},
    {"name":"SUSHI","price":"19.2721","turnover":"1.49"},
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppStyleConfig.themColor,
      body: Container(
        height: 600 + 44.0,
        child: ListView.builder(
          shrinkWrap: true, //为true可以解决子控件必须设置高度的问题
          physics: NeverScrollableScrollPhysics(),
          itemBuilder: (context, index) {
            if(index == 0){
              return PhbTitleCellWidget(title1: "名称",title2: "最新价(USDT)",title3: "24H成交额(USDT)",);
            }
            return CjebCellWidget(dataModel: CjebCellModel.fromJson(dataSource[index-1]),showBottomBorder: index == dataSource.length ? false : true,);
          },
          itemCount: dataSource.length + 1,
        ),
      ),
    );
  }
}
